home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / 2020HalfGateway / 2020Letter.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  9.1 KB  |  223 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        2020Letter.h
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef __2020LETTER__
  15. #define __2020LETTER__
  16.  
  17. #ifndef __BLJSTANDARDINCLUDES__
  18. #include "BLJStandardIncludes.h"
  19. #endif
  20.  
  21. #ifndef __LETTER__
  22. #include "Letter.h"
  23. #endif
  24.  
  25. #ifndef __2020RECIPIENT__
  26. #include "2020Recipient.h"
  27. #endif
  28.  
  29. /***********************************|****************************************/
  30.  
  31. class T2020HalfGateway;
  32. class TVirtualFile;
  33. class TVirtualFolder;
  34. class TRecipientList;
  35. class TRecipient;
  36.  
  37. /***********************************|****************************************/
  38.  
  39. class T2020Letter : public TLetter
  40. {
  41. public:                                T2020Letter ( T2020HalfGateway* halfGateway, long queueID, long sequenceNumber ); //    default constructor
  42.                                     T2020Letter ( T2020HalfGateway* halfGateway, T2020Letter* parentLetter, MailMsgRef mailMsgRef ); // creator for a nested letter
  43.  
  44.     virtual                         ~T2020Letter();
  45.  
  46. public:
  47.     virtual Boolean                 GetLetterID ( BLJLetterID& letterID ) const;
  48.     virtual Boolean                 GetReplyID ( BLJLetterID& replyID ) const;
  49.     virtual Boolean                 GetConversationID ( BLJLetterID& conversationID ) const;
  50.  
  51.     virtual Boolean                 GetSendTimeStamp ( BLJTime& sendTime ) const;
  52.     virtual Boolean                 GetLetterPriority ( TLetter::LetterPriority& priority ) const;
  53.     virtual Boolean                 GetSubject ( TRString& subject ) const;
  54.  
  55.     //    What type of letter is this?
  56.     virtual Boolean                 IsLetterAutoForwarded (Boolean& yesItIs) const;
  57.     virtual Boolean                 IsLetterAutoReply ( Boolean& yesItIs ) const;
  58.     virtual    Boolean                    LetterIsCompleted ( );
  59.  
  60.     //    These routines return booleans related to the reports requested    about this letter.
  61.     virtual Boolean                 DeliveryReceiptRequested ( Boolean &yesItIs ) const;
  62.     virtual Boolean                 NonDeliveryReportRequested ( Boolean& yesItIs ) const;
  63.     virtual Boolean                 EncloseOriginalLetterInReport ( Boolean &yesItIs ) const;
  64.  
  65.     //    What can be done with this letter by the recipient?
  66.     virtual Boolean                 CanLetterBeAutoForwarded (Boolean& yesItCan) const;
  67.  
  68.     //    Get the recipients for this letter
  69.     virtual unsigned short             GetRecipientCount ( RecipientTypeSet recipientType ) const;
  70.     virtual TRecipient*             GetRecipient (RecipientTypeSet recipientType, unsigned short index) const;
  71.  
  72.     //
  73.     //    RECIPIENT REPORTS METHODS
  74.     //    =========================
  75.     //
  76.     virtual Boolean                 GetRecipientStatus(RecipientTypeSet recipientType, unsigned short index, RecipientStatusSet& status) const;
  77.     virtual Boolean                 SetRecipientStatus(RecipientTypeSet recipientType, unsigned short index, RecipientStatusSet status);
  78.     virtual unsigned short             GetUnknownRecipientCount() const;
  79.  
  80.     //    These deal with the content of the message
  81.     virtual unsigned long             GetContentTypeCount ( ) const;
  82.     virtual OSType                     GetContentType ( unsigned long i ) const;
  83.  
  84.     virtual unsigned long             GetSegmentCount( OSType contentType ) const;
  85.     virtual Boolean                 GetSegmentData( OSType contentType, unsigned long index, unsigned long offset,void *data, long& maximumDataSize ) const;
  86.     virtual Boolean                 GetSegmentInfo( OSType contentType, unsigned long index, BLJLetterBlockType& blockType, long& blockLength ) const;
  87.  
  88.     //    This call returns information about the enclosures in the letter
  89.     virtual TVirtualFolder*         GetEnclosuresFolder() const;
  90.  
  91.     //    This call returns another letter which is 'nested' inside of the current letter.
  92.     virtual unsigned short             GetNestedLetterCount() const;
  93.     virtual TLetter*                 GetNestedLetter(unsigned short index) const;
  94.  
  95.     //
  96.     //    A 2020 letter (obviously) occupies a chunk of memory and consumes a mailMsfRef.  Minimize()
  97.     //    will dispose of both the memory usage and close the letter's mailMsfRef.
  98.     //
  99.     virtual void                         Minimize();
  100.  
  101.     /***********************************|****************************************/
  102.     //
  103.     //    OCE LETTER PUBLIC METHODS
  104.     //    ============================
  105.     //
  106.     //    These methods are specific to the OCELetter object.
  107.     //
  108.     /***********************************|****************************************/
  109.     
  110.     //    Return a pointer to the half gateway for this letter.
  111.     T2020HalfGateway *                    GetHalfGateway ( ) const ;    
  112.  
  113.     //    Return the OCE mailMsgRef.  It this letter is not currently open, then open it first
  114.     //    in order to obtain the letterRef; otherwise just return the current mailMsgRef.
  115.     virtual MailMsgRef                     GetMailMsgRef( ) const;
  116.     
  117.     //    Close the letter's OCE mailMsgRef.  Also close
  118.     virtual void                         CloseMailMsgRef( Boolean forceClosed = false ) const;
  119.     
  120.     //    Return the number of letters nested 'inside' this letter.
  121.     virtual unsigned long                GetLetterNestingLevel ( ) const;
  122.     
  123.     //    Is this letter really a OCERecipientReport, which would not be sent but instead use
  124.     //    internally to mark the status of pending letter in the OCEHalfGateway.
  125.     virtual Boolean                     IsLetterAReport ( Boolean& yesItIs ) const;
  126.  
  127.     //    These methods are useful only if the letter is a report.  GetRecipientReportStatusCount() returns the
  128.     //    number of recipients in the report, and GetRecipientReportStatus ( ) return the information for a
  129.     //    particular recipient.
  130.     virtual unsigned long                 GetRecipientReportStatusCount ( ) const;
  131.     virtual Boolean                     GetRecipientReportStatus ( unsigned long index, unsigned short& recipientIndex, OSErr& status ) const;
  132.     
  133.     //
  134.     //    Letter Block access methods.  These methods can be used to get any block from the OCE letter
  135.     //    in a raw format.
  136.     //
  137.     virtual unsigned short                 GetLetterBlockCount() const;
  138.     virtual Boolean                     GetLetterBlockInfo(unsigned short blockIndex, OCECreatorType& blockType, long& offset, long& length) const;
  139.     virtual Boolean                     GetLetterBlockData(OCECreatorType blockType, unsigned short blockNumber,  void* buffer, unsigned long bufferSize, unsigned long startOffsetWithinBlock, unsigned long& returnedDataSize) const;
  140.  
  141.     virtual Boolean                     MarkRecipient (T2020Recipient *recipient);
  142.  
  143.     //    Debugging methods
  144.     virtual ostream&                     DescribeSubclass(ostream& ) const;
  145.     virtual ostream&                     operator >> ( ostream& ) const;
  146.  
  147.     static Boolean                        ForceUnusedAOCELettersClosed ( unsigned long howMany );
  148.         
  149. protected:
  150.  
  151.     //    Get the list of recipients of the given type from the 20/20 letter, and make a
  152.     //    T2020Recipient for each of them.  Put each T2020Recipient into a list, and then
  153.     //    return that list.  This should be used to set up the f[To,Cc,Bcc]Recipients
  154.     //    lists in this object.  Use the MakeResolvedRecipientTypeList to handle resolved recipients.
  155.     void                                 MakeRecipientLists ();
  156.     void                                 InitializeRecipients ();
  157.     void                                InitializeAttributes ( ) ;
  158.     Boolean                             InitializeLetterStandardContentFields ( );
  159.     Boolean                                InitializeLetterImageContentFields ( );
  160.  
  161.     virtual Boolean                     GetStandardContentSegmentData ( unsigned long index, unsigned long offset,void *data, long& maximumDataSize ) const;
  162.     virtual Boolean                     GetStandardContentSegmentInfo ( unsigned long index, BLJLetterBlockType& blockType, long& blockLength ) const;
  163.  
  164.     virtual Boolean                     GetImageContentSegmentData( unsigned long index, unsigned long offset,void *data, long& maximumDataSize ) const;
  165.     virtual Boolean                     GetImageContentSegmentInfo( unsigned long index, BLJLetterBlockType& blockType, long& blockLength ) const;
  166.     
  167. protected:
  168.  
  169.     Boolean                             GetNthTableOfContentItem(unsigned short n, OSType& type, long& offset, long& length) const;
  170.     void                                 SetNthTableOfContentItem(unsigned short n, OSType type, unsigned long offset, unsigned long length);
  171.  
  172.     T2020HalfGateway*                    fHalfGateway;
  173.     long                                fQueueID;    // only used for non-nested top level letter, == 0 for nested letter
  174.     long                                fLetterSequenceNumber; // only used for non-nested top level letter, == 0 for nested letter
  175.  
  176.     T2020Letter*                        fParentLetter; // only used for nested letter, == nil if non nested letter
  177.     MailMsgRef                            fLetterRefNum; // if == 0, letter is not currently open.
  178.     Boolean                                fActivelyBeingUsed;    // true if someone is 'using' the fLetterRefNum
  179.     
  180.     T2020Letter*                        fNestedLetter;
  181.  
  182.     Boolean                                fCachedAttributesInitialized;
  183.     
  184.     MailIndications                        fLetterIndications;
  185.     TRecipientList*                        fRecipients[ bccRecipient - fromRecipient + 1 ];
  186.  
  187.     //    Generic letter content fields
  188.     unsigned short                        fContentTypesCount;
  189.     OSType                                fContentTypes [ 2 ];
  190.     
  191.     //    Standard letter content fields
  192.     Boolean                                fStandardContentInfoHasBeenInitialized;
  193.     unsigned short                        fNumberOfTOCItems;
  194.     TVirtualFile*                        fTableOfContents;
  195.     TVirtualFile*                        fContent;
  196.  
  197.     //    Image content fields
  198.     Boolean                                fContentImageInfoHasBeenInitialized;
  199.     unsigned long                        fContentImagePageCount;
  200.     unsigned long *                        fContentImagePageOffsets;
  201.     
  202.     //    Enclosures fields
  203.     Boolean                                fEnclosuresFolderInitialized;
  204.     TVirtualFolder*                        fEnclosuresFolder;
  205.  
  206.     //    Fields for letters which are 'reports'
  207.     Handle                                fRecipientReportH;        //    Only used if letter is a report.
  208.     unsigned long                        fRecipientReportCount;
  209.  
  210.     MailBlockInfo**                        fLetterBlockInfoListH;    //    Table-of-Contents list information
  211. };
  212.  
  213. /***********************************|****************************************/
  214.  
  215. inline T2020HalfGateway * T2020Letter::GetHalfGateway () const
  216. {
  217.     return fHalfGateway;
  218. }
  219.  
  220. /***********************************|****************************************/
  221.  
  222. #endif    // __2020LETTER__
  223.